<?php $this->render("theader.php");?>

<?php if (!empty($this->closemsg)){
$this->closemsg = str_replace ("'", "\'", $this->closemsg);
$this->closemsg = str_replace ("\r", "", $this->closemsg);
$this->closemsg = str_replace ("\n", "\\n", $this->closemsg);
print <<<EOT
<script language='javascript'>
	alert('{$this->closemsg}');
</script>
EOT;
}?>

<?php if ($this->plan != 'en'){?>
<div class="main_box">   
    <div class="w_986">
    <div class="f_l plate_216 plate">
        <div class="list_plate_bg top_bg"></div>
        <div class="list_plate_bg mid_bg">
            <div class="meet_edit_l_top">
            	<div class="f14 name f_l">欢迎您，<?php echo $this->uinfo['name'];?></div>
          		<a href="<?php echo $this->baseUrl . '/?a=logout&gourl=' . urlencode($this->fullUrl . '/' . $this->minfo['domain']);?>" class="login_out f_r head_bg">注销</a>              
              <div class="clear"></div>
              <?php $arr_status = array('未提交', "待审核", "通过审核", "未通过审核", "最终确认");?>
              <div class=""><span class="c_gray6">状态：</span><span class="c_ora_red"><?php echo $arr_status[$this->ischeck];?></span></div>
            </div>
            
            <div class="meet_edit_l_nav">
            	<ul>
            		<li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=pwd';?>">修改密码</a></li>
                	<li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=puinfo';?>">修改会议平台统一身份认证信息</a></li>
                    <li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=muinfo';?>"  class="selected">填写/修改会议注册信息</a></li>
                    <li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=mfile';?>">上传文件管理</a></li>
                </ul>
            </div>
            
            <div class="clear"></div>
        </div>
        <div class="list_plate_bg bot_bg"></div>

        <div class="list_plate_bg top_bg"></div>
        <div class="list_plate_bg mid_bg" id="list_l_mid">
            <div class="meet_home_l_nav">
            <?php $left = unserialize($this->minfo['left']);
                if (is_array($left)){
                	foreach($left as $index => $v){
                	if ($v['show'] == false)continue;
                	$url = "";
                	if ($v['type'] == 'login')
						$url = $this->baseUrl . '/' . $this->minfo['domain'] . '?a=reg&p=l' . $index;
                	elseif($v['type'] == 'article')
                		$url = $this->baseUrl . '/' . $this->minfo['domain'] . '?a=article&uuid=' . $v['uuid'] . '&p=l' . $index;
                	elseif($v['type'] == 'file')
                		$url = $this->baseUrl . '/' . $this->minfo['domain'] . '?a=file&id=' . $v['uuid'] . '&p=l' . $index;
                	else
                		$url = "#no";
                ?>
          		<a href="<?php echo $url;?>" class="icon_all list_nav"><?php echo $v['name'];?></a> 
          		<?php }}?>
            </div>
            
            <div class="clear"></div>
        </div>
        <div class="list_plate_bg bot_bg"></div>
    </div>
    <div class="f_r plate_756 plate">
        <div class="list_plate_bg top_bg"></div>
        <div class="list_plate_bg mid_bg" id="list_content_mid">
            <div class="">
            	<h2 class="h2_title">会议注册信息 <span class="c_gray6 span_font">( <span class="c_red">*</span> 为必填项 )</span></h2>
                <form method="POST" action="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=muinfo' ?>">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="register_table">
                  <?php 
                  if ($this->minfo['isinvite']){
					$defaultval = $_SESSION['m_invitecode'];
					
					if (!empty($this->icode))
						$defaultval = $this->icode;
                  ?>
                  <tr>
                    <th><span class="c_red">*</span> 邀请码：</th>
                    <td><input id="m_invitecode" name="m_invitecode" value="<?php echo $defaultval;?>" size="20" type="text" class="input_style f_l" style="margin-right:5px;" /></td>
                  </tr>
                <?php }?>
                
                  <?php foreach($this->regitems as $v):
                  if (!$v['show'])continue;
                  	if ($v['type'] == 7){
echo <<<EOT
                  <tr>
                    <td colspan="2"><hr class="hr_bor_bot" /></td>
                  </tr>
EOT;
					}elseif($v['type'] == 8){
echo <<<EOT
                  <tr>
                    <td colspan="2"><div class="meet_info_top_txt">{$v['desc']}</div></td>
                  </tr>
EOT;
					}else{
$title = $v['title'];
$require = $v['required']?'<span class="c_red">*</span>':"";
$str = "";
$def = $this->uitems[$v['uuid']];
$beizhu = $v['beizhu'];
if (!empty($beizhu)){
	$beizhu = "<span  class=\"c_gray9\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $beizhu . "</span>";
}
switch($v['type']){
case 1:
	$str = '<input id="'.$v['uuid'].'" name="' . $v['uuid'] . '" value="' . htmlspecialchars($def) . '" size="40" type="text" class="input_style" />';
	break;
case 2:
	$str = '<textarea id="' .$v['uuid'] . '" name="' . $v['uuid'] .'" cols="40" rows="6">' . htmlspecialchars($def) .'</textarea>';
	break;
case 3:
	$str = "";
	$vals = explode("\n", $v['value']);
	$envals = explode("\n", $v['envalue']);
	foreach($vals as $tindex => $vv){
		$vv = trim($vv);
		if ($vv == $def || $envals[$tindex] == $def)
			$s_checked = " checked=\"checked\"";
		else
			$s_checked = "";
		if ($tindex == 0)
			$str .= '<label><input name="' . $v['uuid'] . '" type="radio" value="' . htmlspecialchars($vv) . '" ' . $s_checked . '/> ' . $vv . '</label>';
		else
			$str .= '<label class="create_radio_margin"><input name="' . $v['uuid'] . '" type="radio" value="' . htmlspecialchars($vv) . '" ' . $s_checked . '/> ' . $vv . '</label>';
	}
	break;
case 4:
	$str = "";
	$vals = explode("\n", $v['value']);
	$envals = explode("\n", $v['envalue']);
	foreach($vals as $tindex => $vv){
		$vv = trim($vv);
		$s_checked = "";
		if (is_array($def)){
			if (in_array($vv, $def) || in_array($envals[$tindex], $def))
				$s_checked = "checked=\"checked\"";
		}
		
		if ($tindex == 0)
			$str .= '<label><input ' . $s_checked .' name="' . $v['uuid'] . '[]" type="checkbox" value="' . htmlspecialchars($vv) . '" /> ' . $vv . '</label>';
		else
			$str .= '<label class="create_radio_margin"><input ' . $s_checked . 'name="' . $v['uuid'] . '[]" type="checkbox" value="' . htmlspecialchars($vv) . '" /> ' . $vv . '</label>';
	}
	break;
case 5:
	$str = "<select id=\"{$v['uuid']}\" name=\"" . $v['uuid'] . "\">";
	$vals = explode("\n", $v['value']);
	$envals = explode("\n", $v['envalue']);
	foreach($vals as $tindex => $vv){
		$vv = trim($vv);

		if ($vv == $def || $envals[$tindex] == $def)
			$s_checked = " selected=\"selected\"";
		else
			$s_checked = "";
		
		$str .= '<option ' . $s_checked . ' value="' . htmlspecialchars($vv) . '">' . $vv . '</option>';
	}
	$str .= "</select>";
	break;
case 6:
	$str = '<input value="' . htmlspecialchars($def) .'" id="' . $v['uuid'] . '" name="' . $v['uuid'] . '" size="20" type="text" class="input_style f_l datepicker_start" style="margin-right:5px;"/>';
	break;
}
echo <<<EOT
				<tr>
				<th>{$require} {$title}：</th>
				<td>{$str}&nbsp;&nbsp;{$beizhu}</td>
				</tr>
EOT;
					}
                  ?>
                  <?php endforeach;?>
                  <tr class="tr_h20">
                    <th></th>
                    <td></td>
                  </tr>
                  <tr <?php if ($this->isclose){echo "style='display:none'";}?>>
                    <th></th>
                    <td><input id="form_submit" name="form_submit" type="submit" value="提 交" class="btn_blue30 line_bg_all" /></td>
                  </tr>
                </table>
			</form>
            </div>
            
                    
            <div class="clear"></div>
        </div>
        <div class="list_plate_bg bot_bg"></div>
    </div>
    <div class="clear"></div>
    </div>    
    
</div>


<?php $GLOBALS['nomanage'] = true;$this->render("footer.php");?>

<?php if ($this->change){?>
<script>
alert("会议注册信息提交成功,请等待审核。");
</script>
<?php }?>


<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
<script>
$(function() {
	$(".datepicker_start").datepicker({buttonImageOnly: true,buttonImage: "images/calendar.png",showOn: "button",
		changeMonth:true,constrainInput:true});

	$('#form_submit').click(form_submit_check);
});

// 必填项检测
function form_submit_check()
{
	var val = "";
	if ($("#m_invitecode").length > 0){
		val = $("#m_invitecode").val();
		if (val == ''){
			alert("请填写邀请码！");
			return false;
		}
	}
	var checkitem = [];
	<?php
	$arr = array();
	foreach($this->regitems as $v){
if (!$v['show'])continue;
	if ($v['required']){
		$arr[] = array($v['uuid'], $v['title'],$v['type']);	
	}
	}
		echo "checkitem=" . json_encode($arr) . ';';
	?>

	for(var i=0; i<checkitem.length; i++)
	{
		var item = checkitem[i];
		if (item[2] == 3){// 单选
			val = $(':radio[name="'+item[0]+'"][checked]').val();
		}else if(item[2] == 4){// 多选
			val = $(':checkbox[name="'+item[0]+'[]"][checked]').length;
		}else{
			val = $("#" + item[0]).val();
		}
		
		if (typeof(val) == 'undefined' || val == '' || val == 0){
			alert(item[1]+" 为必填项");
			return false;
		}
	}

	
	$.post("./index.php?c=meet&a=checkinvite&mid=<?php echo $this->mid;?>", {"m_invitecode":$("#m_invitecode").val()}, 
			function (data){
			if (data == 'T'){
				$('form').submit();
			}else{
				alert(data);
			}
		});
	return false;
}
</script>
</body>
</html>




<?php }else{?>
<div class="main_box">   
    <div class="w_986">
    <div class="f_l plate_216 plate">
        <div class="list_plate_bg top_bg"></div>
        <div class="list_plate_bg mid_bg">
            <div class="meet_edit_l_top">
            	<div class="f14 name f_l">Welcome，<?php echo $this->uinfo['name'];?></div>
          		<a href="<?php echo $this->baseUrl . '/?a=logout&gourl=' . urlencode($this->fullUrl . '/' . $this->minfo['domain'] . '?lan=en');?>" class="login_out f_r head_bg">Logout</a>              
              <div class="clear"></div>
              <?php $arr_status = array('To Be Submitted', "To Be Verified", "Already Verified", "Not Passed", "Finally Confirmed");?>
              <div class=""><span class="c_gray6">Status：</span><span class="c_ora_red"><?php echo $arr_status[$this->ischeck];?></span></div>
            </div>
            
            <div class="meet_edit_l_nav">
            	<ul>
            	<li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=pwd';?>">Modify Password</a></li>
                	<li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=puinfo';?>">Modify Unified Identity Information of Platform</a></li>
                    <li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=muinfo';?>"  class="selected">Fill in / Modify Conference Registration Information</a></li>
                    <li class="li_nav"><a href="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=mfile';?>">Uploaded File(s)</a></li>
                </ul>
            </div>
            
            <div class="clear"></div>
        </div>
        <div class="list_plate_bg bot_bg"></div>
    
        <div class="list_plate_bg top_bg"></div>
        <div class="list_plate_bg mid_bg" id="list_l_mid">
            <div class="meet_home_l_nav">
            <?php $left = unserialize($this->minfo['left']);
                if (is_array($left)){
                	foreach($left as $index => $v){
                	if ($v['show'] == false)continue;
                	$url = "";
                	if ($v['type'] == 'login')
						$url = $this->baseUrl . '/' . $this->minfo['domain'] . '?a=reg&p=l' . $index;
                	elseif($v['type'] == 'article')
                		$url = $this->baseUrl . '/' . $this->minfo['domain'] . '?a=article&uuid=' . $v['uuid'] . '&p=l' . $index;
                	elseif($v['type'] == 'file')
                		$url = $this->baseUrl . '/' . $this->minfo['domain'] . '?a=file&id=' . $v['uuid'] . '&p=l' . $index;
                	else
                		$url = "#no";
                ?>
          		<a href="<?php echo $url;?>" class="icon_all list_nav"><?php echo $v['enname'];?></a> 
          		<?php }}?>
            </div>
            
            <div class="clear"></div>
        </div>
        <div class="list_plate_bg bot_bg"></div>
    </div>
    <div class="f_r plate_756 plate">
        <div class="list_plate_bg top_bg"></div>
        <div class="list_plate_bg mid_bg" id="list_content_mid">
            <div class="">
            	<h2 class="h2_title">Conference Registration Info <span class="c_gray6 span_font">( <span class="c_red">*</span> is required. )</span></h2>
                <form method="POST" action="<?php echo $this->baseUrl . '/' . $this->minfo['domain'] . '?a=muinfo' ?>">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="register_table">
                  <?php 
                  if ($this->minfo['isinvite']){
					$defaultval = $_SESSION['m_invitecode'];
					
					if (!empty($this->icode))
						$defaultval = $this->icode;
                  ?>
                  <tr>
                    <th><span class="c_red">*</span> Invitation Code：</th>
                    <td><input id="m_invitecode" name="m_invitecode" value="<?php echo $defaultval;?>" size="20" type="text" class="input_style f_l" style="margin-right:5px;" /></td>
                  </tr>
                <?php }?>
                
                  <?php                   
                   foreach($this->regitems as $v):
                  if (!$v['show'])continue;
                  	if ($v['type'] == 7){
echo <<<EOT
                  <tr>
                    <td colspan="2"><hr class="hr_bor_bot" /></td>
                  </tr>
EOT;
					}elseif($v['type'] == 8){
echo <<<EOT
                  <tr>
                    <td colspan="2"><div class="meet_info_top_txt">{$v['endesc']}</div></td>
                  </tr>
EOT;
					}else{
$title = $v['entitle'];
$beizhu = $v['enbeizhu'];
if (!empty($beizhu)){
	$beizhu = "<br /><span  class=\"c_gray9\">" . $beizhu . "</span><br /><br />";
}
$require = $v['required']?'<span class="c_red">*</span>':"";
$str = "";
$def = $this->uitems[$v['uuid']];
switch($v['type']){
case 1:
	$str = '<input id="'.$v['uuid'].'" name="' . $v['uuid'] . '" value="' . htmlspecialchars($def) . '" size="40" type="text" class="input_style" />';
	break;
case 2:
	$str = '<textarea id="' .$v['uuid'] . '" name="' . $v['uuid'] .'" cols="40" rows="6">' . htmlspecialchars($def) .'</textarea>';
	break;
case 3:
	$str = "";
	$vals = explode("\n", $v['envalue']);
	$cnvals = explode("\n", $v['value']);
	foreach($vals as $tindex => $vv){
		$vv = trim($vv);
		if ($vv == $def || $cnvals[$tindex] == $def)
			$s_checked = " checked=\"checked\"";
		else
			$s_checked = "";
		if ($tindex == 0)
			$str .= '<label><input name="' . $v['uuid'] . '" type="radio" value="' . htmlspecialchars($vv) . '" ' . $s_checked . '/> ' . $vv . '</label>';
		else
			$str .= '<label class="create_radio_margin"><input name="' . $v['uuid'] . '" type="radio" value="' . htmlspecialchars($vv) . '" ' . $s_checked . '/> ' . $vv . '</label>';
	}
	break;
case 4:
	$str = "";
	$vals = explode("\n", $v['envalue']);
	$cnvals = explode("\n", $v['value']);
	foreach($vals as $tindex => $vv){
		$vv = trim($vv);
		$s_checked = "";
		if (is_array($def)){
			if (in_array($vv, $def) || in_array($cnvals[$tindex], $def))
				$s_checked = "checked=\"checked\"";
		}
		
		if ($tindex == 0)
			$str .= '<label><input ' . $s_checked .' name="' . $v['uuid'] . '[]" type="checkbox" value="' . htmlspecialchars($vv) . '" /> ' . $vv . '</label>';
		else
			$str .= '<label class="create_radio_margin"><input ' . $s_checked . 'name="' . $v['uuid'] . '[]" type="checkbox" value="' . htmlspecialchars($vv) . '" /> ' . $vv . '</label>';
	}
	break;
case 5:
	$str = "<select id=\"{$v['uuid']}\" name=\"" . $v['uuid'] . "\">";
	$vals = explode("\n", $v['envalue']);
	$cbnvals = explode("\n", $v['value']);
	foreach($vals as $tindex => $vv){
		$vv = trim($vv);

		if ($vv == $def || $cbnvals[$tindex] == $def)
			$s_checked = " selected=\"selected\"";
		else
			$s_checked = "";
		
		$str .= '<option ' . $s_checked . ' value="' . htmlspecialchars($vv) . '">' . $vv . '</option>';
	}
	$str .= "</select>";
	break;
case 6:
	$str = '<input value="' . htmlspecialchars($def) .'" id="' . $v['uuid'] . '" name="' . $v['uuid'] . '" size="20" type="text" class="input_style f_l datepicker_start" style="margin-right:5px;"/>';
	break;
}
echo <<<EOT
				<tr>
				<th>{$require} {$title}：</th>
				<td>{$str}&nbsp;&nbsp;{$beizhu}</td>
				</tr>
EOT;
					}
                  ?>
                  <?php endforeach;?>
                  <tr class="tr_h20">
                    <th></th>
                    <td></td>
                  </tr>
                  <tr <?php if ($this->isclose){echo "style='display:none'";}?>>
                    <th></th>
                    <td><input id="form_submit" name="form_submit" type="submit" value="Submit" class="btn_blue30 line_bg_all" /></td>
                  </tr>
                </table>
			</form>
            </div>
            
                    
            <div class="clear"></div>
        </div>
        <div class="list_plate_bg bot_bg"></div>
    </div>
    <div class="clear"></div>
    </div>    
    
</div>


<?php $GLOBALS['nomanage'] = true;$this->render("footer.php");?>

<?php if ($this->change){?>
<script>
alert("Conference registration information is submitted successfully. Please wait for verification.");
</script>
<?php }?>


<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript" src="js/jquery-ui/jquery.ui.datepicker-en-GB.js"></script>
<script>
$(function() {
	$(".datepicker_start").datepicker({buttonImageOnly: true,buttonImage: "images/calendar.png",showOn: "button",
		changeMonth:true,constrainInput:true});

	$('#form_submit').click(form_submit_check);
});

// 必填项检测
function form_submit_check()
{
	var val = "";
	if ($("#m_invitecode").length > 0){
		val = $("#m_invitecode").val();
		if (val == ''){
			alert("Please fill in the invitation code.");
			return false;
		}
	}
	var checkitem = [];
	<?php
	$arr = array();
	foreach($this->regitems as $v){
	if (!$v['show'])continue;
	if ($v['required']){
		$arr[] = array($v['uuid'], $v['entitle'],$v['type']);	
	}
	}
		echo "checkitem=" . json_encode($arr) . ';';
	?>

	for(var i=0; i<checkitem.length; i++)
	{
		var item = checkitem[i];
		if (item[2] == 3){// 单选
			val = $(':radio[name="'+item[0]+'"][checked]').val();
		}else if(item[2] == 4){// 多选
			val = $(':checkbox[name="'+item[0]+'[]"][checked]').length;
			//console.log(item[0]);
		}else{
			val = $("#" + item[0]).val();
		}
		
		if (typeof(val) == 'undefined' || val == '' || val == 0){
			alert(item[1]+" is required.");
			return false;
		}
	}
	$.post("./index.php?c=meet&a=checkinvite&mid=<?php echo $this->mid;?>", {"m_invitecode":$("#m_invitecode").val()}, 
			function (data){
			if (data == 'T'){
				$('form').submit();
			}else{
				alert(data);
			}
		});
	return true;
}
</script>
</body>
</html>
<?php }?>
